Hashing or Message Digest
-
Hashing is method to achieve Integrity
What is Hashing? Transforming String into FIXED-LENGTH string Value. From Hash Message cannot be retrieved back. Hash function should not generate same value for different input strings.
MD5 started producing that and hence considered broken.
Kumar > | Hash Function | > random_string
- Why to use Hash
- How GPU can crack a Hash?
They contain numerous cores that can execute instructions simultaneously, making them well-suited for tasks like hashing, which involve performing the same operation on multiple inputs simultaneously.
GPUs can test a large number of password guesses(Brute force) in parallel, making them much faster at trying different combinations.
But Argon2 hash is GPU resistant.
Hashing Algorithms
Algo | SHA1 SHA0(broken) |
SHA256 (not broken) |
SHA3_512 Keccak |
MD4,MD5(broken) |
---|---|---|---|---|
Published | 1995 | 2012 | 2015 | 2015 |
Input | 2128 bit | 2128 bit | 264 bit | infinite |
Output Hash(bits) | 160 | 256 | 512 | 128 |
MD5
1. Take four 32-bit words, initialized to fixed constants.
C1(01 23 45 67), C2:(89 ab cd ef), C3(fe dc ba 98), C4(76 54 32 10)
2. Take 4 Functions
f(x,y,z) = (x & y) | ((~x) & z)
g(x,y,z) = (x & z)| (y & (~z))
h(x,y,z) = x ^ y ^ z
i(x,y,z) = y ^ (x | (~z))
3. Break input into 32-bit words
Input(512 bits) -> |Break into 16 pieces| -> m1 .. m16
if input is not 512 bit pad it
4. Perform 4 or 16 round Operations.
//AM: Addition Modulo
Round-1: F(K2,K3,K4) -> AM -> AM -> |Rotate left bit by s places| -> AM -> K2
/\ /\ /\
C1 m1 C2
Round-2: For m2 and so on..
Argon2
- How Argon2 is GPU resistant?
Argon2 is a memory-hard hashing algorithm, meaning that it requires a lot of memory to be computed.
Since GPU typically have less memory available compared to CPUs. As a result, even though GPUs can perform computations quickly, they may struggle with the memory requirements of Argon2.
While GPUs excel at parallel computations, Argon2 is designed to require significant serial computation as well.
This means that even though GPUs can try many password guesses in parallel, they may still be limited by the sequential nature of certain parts of the Argon2 algorithm.
Argon2 allows for the adjustment of parameters(such as the memory cost, time cost, and parallelism degree)
By appropriately configuring these parameters, it's possible to tune Argon2 to be less susceptible to GPU-based attacks
Argon2, Argon2i, Argon2id
Usage/Feature | Resistant to | |
---|---|---|
argon2 | preferred for password hashing and key derivation | because it's resistant to side-channel attacks |
argon2d | more resistant to GPU attacks | |
argon2id | hybrid of Argon2i and Argon2d |
MAC
(Message + Pvt Key) > |Hash function| > MAC
HMAC(Hashed MAC)
secret Key ->(XOR) <- Inner Pad Secret Key-> (XOR) <- Outer Pad
\/ \/
M1 M2
|M-1| Message | M2 |